cmake_minimum_required(VERSION 3.5.1)  

# set(CMAKE_C_COMPILER "gcc")
# set(CMAKE_CXX_COMPILER "g++")

set(CMAKE_C_COMPILER   "arm-anykav500-linux-uclibcgnueabi-gcc")
set(CMAKE_CXX_COMPILER "arm-anykav500-linux-uclibcgnueabi-g++")
SET(CMAKE_C_FLAGS   "$ENV{CXXFLAGS} -std=c99   -Wall -g3")
SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -std=c++1y -Wall -g3")

SET(ProName demo)
project(${ProName} C)

# 添加宏定义
add_definitions(
    -DBUILD_PATH="${CMAKE_CURRENT_SOURCE_DIR}"
	-D_GNU_SOURCE
)

# 包含文件夹
include_directories(
	user_socket/
	_wasApp/
)

# 添加子目录编译路径, 需要子目录存在CMakelists.txt
add_subdirectory(user_socket)
add_subdirectory(_wasApp)



aux_source_directory(. DIR_SRCS)

set(LIBS ${LIBS} _wasApp)
set(LIBS ${LIBS} _user_socket)

add_executable(${ProName} ${DIR_SRCS})  #链接生成文件${ProName} 由DIR_SRC链接。

# 指定安装路径和安装文件
# set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/install)	
# set(INSTALL_FILES ${INSTALL_FILES} src/FileDataApi.h)
# set(INSTALL_FILES ${INSTALL_FILES} src/func.h)
# set(INSTALL_FILES ${INSTALL_FILES} src/log_info.h)
# set(INSTALL_TARGETS ${INSTALL_TARGETS} ${LIBS})
# install(TARGETS ${INSTALL_TARGETS} DESTINATION lib)
# install(FILES ${INSTALL_FILES} DESTINATION include)



# 链接库
target_link_libraries(${ProName} -Wl,--start-group

	# share lib
	${LIBS}
	
	# stand lib
	m
	pthread
	dl

	
	-Wl,--end-group
)


